home *** CD-ROM | disk | FTP | other *** search
- '============================================================================
- 'I made this program to show you how to get a little bit of information
- 'that is sometimes needed when manipulating directory files and retriev
- 'ing dos information, I'm hopeful that this program will be of some aid
- 'for you.
-
- 'QCOPY can be named any name you wish.
-
- 'SYNTAX: QCOPY [dir/specs]filename.ext [dir/specs]filename.ext
-
- 'NOTE: if an error occurs with QCOPY no message or error number is
- ' returned or printed on screen, QCOPY just terminates.
-
- 'For a personal copy program, check out COPYPRO in this forum, QCOPY
- 'is Free.
-
- 'QCOPY 1.0, S. Roepenack 1993
- 'for other programs, search with ID# 70373,516
-
- '============================================================================
- 'Shell out to dos and make a file that its contents are of the current
- 'directory, the *.* could be *.BAS for only Bas Files, you could also
- 'use a path c:\*.*. the file name can be any name.
-
- '$DYNAMIC
-
- CLS : SCREEN 0
- SHELL "DIR *.* > QDIR.FIL"
-
- '============================================================================
- 'Count the number of Entrys needed to read into the DirArray$(), LineCount
- 'will give you the right number of dimensions needed for the array.
-
- OPEN "QDIR.FIL" FOR INPUT AS #1
-
- DO UNTIL EOF(1)
- LINE INPUT #1, junk$
- IF INSTR(FileLine$, "<DIR>") = 0 THEN
- LineCount = LineCount + 1
- END IF
- LOOP
-
- CLOSE #1
-
- '============================================================================
- 'Dimension the array with LineCount
-
- DIM DirArray$(LineCount)
-
- '============================================================================
- 'Now open the file again and read it line by line into the DirArray()
- 'excluding any "<DIR>" found in QDIR.FIL, after reading it, close it
- 'and delete it from the current directory.
-
- OPEN "QDIR.FIL" FOR INPUT AS #1
-
- DO UNTIL EOF(1)
-
- LINE INPUT #1, FileLine$
-
- IF INSTR(FileLine$, "<DIR>") = 0 THEN
- DirEntry = DirEntry + 1
- DirArray$(DirEntry) = LTRIM$(FileLine$)
- END IF
-
- LOOP
-
- CLOSE #1: KILL "QDIR.FIL"
-
- '============================================================================
- 'Setting the variables Directory, Volume Label and so forth are determend
- 'by what line there on, DirEntry contains the highest count, inspecting
- 'the dir command directly from dos will give a better idea on how
- 'LineCount was used.
-
- LOCATE 2, 1: PRINT "( QuickSave with QCOPY and directory file manipulating )";
- LOCATE 3, 1: PRINT STRING$(80, "-");
-
- Directory = 4
- VolumeLabel = 2
- SerialNumber = 3
- DirFiles = DirEntry - 1
- BytesFree = DirEntry
-
- LOCATE 5, 1: PRINT SPC(29); "DIRECTORY INFORMATION"
-
- LOCATE 7, 5: PRINT " Directory: " + DirArray$(Directory);
- LOCATE 8, 5: PRINT " Volume Label: " + DirArray$(VolumeLabel);
- LOCATE 9, 5: PRINT "Serial Number: " + DirArray$(SerialNumber);
- LOCATE 10, 5: PRINT " Files: " + DirArray$(DirFiles);
- LOCATE 11, 5: PRINT " Bytes Free: " + DirArray$(BytesFree);
-
- LOCATE 13, 1: PRINT STRING$(80, "-");
- LOCATE 15, 1: PRINT SPC(27); "DIRECTORY FILE INFORMATION"
-
- LOCATE 17, 9: PRINT " File: ";
- LOCATE 18, 9: PRINT "File Size: ";
- LOCATE 19, 9: PRINT "File Date: ";
- LOCATE 20, 9: PRINT "File Time: ";
-
- LOCATE 22, 9: PRINT "Selected: ";
- LOCATE 23, 10: PRINT "Save AS: ";
-
- LOCATE 19, 45: PRINT "Up, Down Arrow: File Selection";
- LOCATE 18, 45: PRINT " Enter Key: Except Selection";
- LOCATE 20, 45: PRINT " Escape Key: Quit Program";
-
- '============================================================================
- 'Min is set to the least number and Max is set to the highest directory
- 'file in the array, the array index increases or decreases depending on
- 'what arrow key is pressed. DirArray is broken down into its components
- 'by using left$, right$ and mid$, to inspect this directly put a rem in
- 'front of FLeft$, FRight$, File$ and add this in place of them,
- 'File$ = DirArray$(ArrayIndex), the whole array will contain the line
- 'it read from QDIR.FIL.
-
- Min = 5
- Max = (DirEntry - 2)
- ArrayIndex = Min
-
- UP$ = CHR$(0) + CHR$(72)
- DOWN$ = CHR$(0) + CHR$(80)
- ESCAPE$ = CHR$(27)
- ENTER$ = CHR$(13)
-
- DO
-
- DO
- key$ = INKEY$
- LOOP WHILE key$ = ""
-
- IF key$ = ENTER$ THEN EXIT DO
- IF key$ = ESCAPE$ THEN END'Program
-
- IF (key$ = UP$ AND (ArrayIndex > Min)) THEN
- ArrayIndex = ArrayIndex - 1
- ELSEIF (key$ = DOWN$ AND (ArrayIndex < Max)) THEN
- ArrayIndex = ArrayIndex + 1
- END IF
-
- IF (ArrayIndex > Min) AND (ArrayIndex < Max) THEN
-
- FLeft$ = RTRIM$(LEFT$(DirArray$(ArrayIndex), 8))
- FRight$ = RTRIM$(MID$(DirArray$(ArrayIndex), 10, 3))
-
- File$ = FLeft$ + "." + FRight$
- FileSize$ = LTRIM$(MID$(DirArray$(ArrayIndex), 13, 10))
- FileDate$ = MID$(DirArray$(ArrayIndex), 24, 8)
- FileTime$ = MID$(DirArray$(ArrayIndex), 34, 6)
-
- LOCATE 17, 21: PRINT SPACE$(12);
-
- LOCATE 17, 21: PRINT File$;
- LOCATE 18, 21: PRINT FileSize$;
- LOCATE 19, 21: PRINT FileDate$;
- LOCATE 20, 21: PRINT FileTime$;
-
- ELSE
-
- SOUND 67, .5
-
- END IF
-
- LOOP
-
- PRINT ""
- LOCATE 22, 9: PRINT "Selected: " + File$
- LOCATE 23, 10: PRINT "Save AS: ";
- LINE INPUT SaveASFileName$
-
- 'This will create another copy of File$ AS SaveASFileName$
-
- 'SHELL "QCOPY " + File$ + " " + SaveASFileName$
-
- END
-
-